import serial, org.hamrepeater.repeater.repeater, org.hamrepeater.audio.mixer,time

import time

mix = org.hamrepeater.audio.mixer.Mixer()

mix.start()


x = org.hamrepeater.repeater.repeater.Factory().getRepeater("TXU1256")


txrunning = False

An = True
old = time.time()

while True:
    try:
      
        #before = time.time()
        snr = x.getSignalToNoiseRatio()
        power = mix.getPower(2, True, 203.5)
        print power
        x.startTransmit()
        #if power > 10**11:
        #    x.startTransmit()
        #    print "an:", power
        #else:
        #    x.stopTransmit()
        #    print "aus", power
    
        #if snr > 10 and not txrunning:
        #    print "schalte ein"
        #    x.startTransmit()
        #    txrunning = True
        #else:
        #    if snr < 10 and txrunning:
        #        print "schalte ab"
        #        x.stopTransmit()
        #        txrunning = False
        
        
        
        
    except Exception, value:
        print value
    
        
        
    #print snr
        
    #print "ZEIT:", time.time() - before


  

